<?php declare(strict_types=1);


namespace App\Dao;


use App\Exception\DaoException;
use App\Model\PackDownLog;

class PackDownLogDao
{

    /**
     * @param $hash
     * @return \Hyperf\Database\Model\Builder|\Hyperf\Database\Model\Model|object
     * @throws DaoException
     */
    public function findByHas($hash)
    {
        $one = PackDownLog::query()
            ->where('hash', '=', $hash)
            ->select(['hash','event_name','path','file_name'])->first();
        if(!$one) {
            throw new DaoException('文件不存在');
        }
        return  $one;
    }
}